<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {
    public function index(){
    	
    	$assign['channel_id'] = !empty($_POST['channel_id'])?$_POST['channel_id']:'shunion';
    	$assign['shop_key'] = !empty($_POST['shop_key'])?$_POST['shop_key']:'';
    	$assign['show_name'] = !empty($_POST['show_name'])?$_POST['show_name']:'上海导购网会员';
    	$assign['username'] = !empty($_POST['username'])?$_POST['username']:'test@shunion.com.cn';
    	$assign['u_id'] = !empty($_POST['u_id'])?$_POST['u_id']:'100';
    	$assign['target_url'] = !empty($_POST['target_url'])?$_POST['target_url']:'';
    	$assign['email'] = !empty($_POST['email'])?$_POST['email']:'test@shunion.com.cn.com';
    	$assign['tracking_code'] = !empty($_POST['tracking_code'])?$_POST['tracking_code']:'shunion_1';
    	$assign['name'] = !empty($_POST['name'])?$_POST['name']:'测试';
    	$assign['province'] = !empty($_POST['province'])?$_POST['province']:'上海';
    	$assign['city'] = !empty($_POST['city'])?$_POST['city']:'上海市';
    	$assign['area'] = !empty($_POST['area'])?$_POST['area']:'长宁区';
    	$assign['address'] = !empty($_POST['address'])?$_POST['address']:'上海市长宁区长宁路546号';
    	$assign['zip'] = !empty($_POST['zip'])?$_POST['zip']:'200040';
    	$assign['phone'] = !empty($_POST['phone'])?$_POST['phone']:'021-000000';
    	$assign['mobile'] = !empty($_POST['mobile'])?$_POST['mobile']:'13666666666';
    	
    	$action_time = time();

    	$url = $_POST['url'];
    	  	
    	$url = str_replace('(channel_id)',$assign['channel_id'],$url);
    	$url = str_replace('(u_id)',$assign['u_id'],$url);
    	$url = str_replace('(target_url)',urlencode($assign['target_url']),$url);
    	$url = str_replace('(email)',urlencode($assign['email']),$url);
    	$url = str_replace('(tracking_code)',$assign['tracking_code'],$url);
    	$url = str_replace('(username)',urlencode($assign['username']),$url);
    	$url = str_replace('(show_name)',urlencode($assign['show_name']),$url);
    	$url = str_replace('(name)',urlencode($assign['name']),$url);
    	$url = str_replace('(province)',urlencode($assign['province']),$url);
    	$url = str_replace('(city)',urlencode($assign['city']),$url);
    	$url = str_replace('(area)',urlencode($assign['area']),$url);
    	$url = str_replace('(address)',urlencode($assign['address']),$url);
    	$url = str_replace('(zip)',$assign['zip'],$url);
    	$url = str_replace('(phone)',$assign['phone'],$url);
    	$url = str_replace('(mobile)',$assign['mobile'],$url);
    	$url = str_replace('(action_time)',time(),$url);
    	
    	$code = md5($assign['username'].$assign['shop_key'].$action_time);
    	
    	$url = str_replace('(code)',$code,$url);
    	
    	$key = md5('Jackie.2012');
    	
    	$shkeyStr = $assign['shop_key'].date('Ymdhis',time());
    	
    	$shkey = encrypt($shkeyStr,$key);
    	
    	$url = str_replace('(shkey)',$shkey,$url);
    	
    	$assign['testUrl'] = $url;
    	
    	$this->assign($assign);
    	$this->display();
    }
}